/**
 * Copyright (c) 2009-2011, chunquedong(YangJiandong)
 * 
 * This file is part of ChunMap project
 * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE(Version >=3)
 * 
 * History:
 *     2010-05-05  Jed Young  Creation
 */
package chunmap.raster.grid;

import java.util.ArrayList;
import java.util.List;

import chunmap.data.feature.Raster;
import chunmap.model.elem.Envelope;
import chunmap.raster.grid.data.GridDataSource;

/**
 * 网格
 * 
 * @author chunquedong
 * 
 */
public class Grid implements Comparable<Grid> {
	private double scale;
	private String parameters;

	private GridDataSource gridData;
	private Envelope subEnvelop;//第一个瓦片代表的实际范围。此字段几乎没有什么用。
	private List<Raster> tiles = new ArrayList<Raster>();

	public GridDataSource getGridData() {
		return gridData;
	}

	public void setGridData(GridDataSource gridData) {
		this.gridData = gridData;
	}

	public String getName() {
		String directoryName = parameters + "_" + scale;
		return directoryName;
	}

	public String getParameters() {
		return parameters;
	}

	public void setParameters(String parameters) {
		this.parameters = parameters;
	}

	public List<Raster> getTiles() {
		return tiles;
	}

	public void setTiles(List<Raster> tiles) {
		this.tiles = tiles;
	}

	public double getScale() {
		return scale;
	}

	public void setScale(double scale) {
		this.scale = scale;
	}

	public Envelope getSubEnvelop() {
		return subEnvelop;
	}

	public void setSubEnvelop(Envelope subEnvelop) {
		this.subEnvelop = subEnvelop;
	}

	@Override
	public int compareTo(Grid other) {

		return Double.compare(this.scale, other.getScale());
	}
}